    package HomeWork;

    import java.util.Scanner;

    public class MaxNumber {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);

            // 输入三个整数
            System.out.println("请输入三个整数:");
            int num1 = scanner.nextInt();
            int num2 = scanner.nextInt();
            int num3 = scanner.nextInt();

            // 求最大值和最小值
            int max = findMax(num1, num2, num3);
            int min = findMin(num1, num2, num3);

            // 输出结果
            System.out.println("输入的三个整数为: " + num1 + ", " + num2 + ", " + num3);
            System.out.println("最大值是: " + max);
            System.out.println("最小值是: " + min);

            scanner.close();
        }

        // 函数：找出三个数中的最大值
        public static int findMax(int a, int b, int c) {
            int max = a;
            if (b > max) {
                max = b;
            }
            if (c > max) {
                max = c;
            }
            return max;
        }

        // 函数：找出三个数中的最小值
        public static int findMin(int a, int b, int c) {
            int min = a;
            if (b < min) {
                min = b;
            }
            if (c < min) {
                min = c;
            }
            return min;
        }
    }
